#!/bin/bash
#2021年 12月 06日 星期一 22:59:50 CST
echo "version: 1.4 for wps-office 11.1.0.10702"
echo "Author: Feng Zhenhua(冯振华)"
printf "Date: "
date 
#检测系统版本
printf "System Information:"
uname -a
# 发出执行命令
echo "wps-office pdf component removing ......"
# remove wps-office-pdf.desktop
if [ -f /usr/share/applications/wps-office-pdf.desktop ];
then
    echo "1.removing /usr/share/applications/wps-office-pdf.desktop"
    sudo rm /usr/share/applications/wps-office-pdf.desktop
else
  echo "1./usr/share/applications/wps-office-pdf.desktop had been removed." 
fi
# remove wpspdf
if [ -f /usr/bin/wpspdf ];
then
   echo "2.removing /usr/bin/wpspdf"
   sudo rm /usr/bin/wpspdf
else
 echo "2./usr/bin/wpspdf had been removed." 
fi
# 删除主程序中的wpspdf
if [ -f /usr/lib/office6/wpspdf ];
then
  echo "3.removing /usr/lib/office6/wpspdf"
   sudo rm /usr/lib/office6/wpspdf
else
 echo "3./usr/lib/office6/wpspdf had been removed."
fi
if [ -f /usr/lib/office6/libpdfmain.so ];
then
 echo "4.removing /usr/lib/office6/libpdfmain.so"
    sudo rm /usr/lib/office6/libpdfmain.so 
else
 echo "4./usr/lib/office6/libpdfmain.so  had been removed."
fi
# 删除wps-office*pdf* 图标
if [ -f /usr/share/icons/hicolor/16x16/apps/wps-office2019-pdfmain.png ];
then
 sudo rm /usr/share/icons/hicolor/*/apps/wps-office*pdf*
   echo "5.All /usr/share/icons/hicolor/*/apps/wps-office*pdf* had been removed"
else
 echo "5.All /usr/share/icons/hicolor/*/apps/wps-office*pdf* had been removed"
fi
# 删除关联图标
if [ -f /usr/share/icons/hicolor/16x16/mimetypes/wps-office-pdf.png ];
then
   sudo rm /usr/share/icons/hicolor/*/mimetypes/wps-office*pdf*
  echo "6.All /usr/share/icons/hicolor/*/mimetypes/wps-office*pdf* had been removed."
else
   echo "6.All /usr/share/icons/hicolor/*/mimetypes/wps-office*pdf* had been removed."
fi
# 删除配置文件中的pdf信息
if [ -f /usr/lib/office6/mui/zh_CN/pdf.qm ];
then
    sudo rm /usr/lib/office6/mui/zh_CN/*pdf*
  echo "7.All pdf related file which in the mui folder  had been removed"
else
   echo "7.All pdf related file which in the mui folder  had been removed"
fi
# 禁用轻办公
if [ -f /usr/lib/office6/wpscloudsvr ];
then
    sudo mv  /usr/lib/office6/wpscloudsvr /usr/lib/office6/wpscloudsvr_bak
  echo "8. /usr/lib/office6/wpscloudsvr  had been renamed"
else
  echo "8. /usr/lib/office6/wpscloudsvr  had been renamed"
fi
if [ -f /usr/lib/office6/cfgs/product.dat ];
then
# 去除国际版侧边栏中的”团队“和”会议“
    sudo sed -i 's/rz8f5btwwRveXzQbE1BceItXQPz7r5gLNWXNGWkK_Hs.=WHfH10HHgeQrW2N48LfXrA..//g' /usr/lib/office6/cfgs/product.dat
# 去除“您正在使用访客账号”
 sudo sed -i 's/JYcm_wejKY0DbtmzYoUk5Q..=WHfH10HHgeQrW2N48LfXrA..//g' /usr/lib/office6/cfgs/product.dat
# 去除“未保存”和“协作”
  sudo sed -i 's/vMVENEUpsDRRrn9w2_8R4g..=WHfH10HHgeQrW2N48LfXrA..//g' /usr/lib/office6/cfgs/product.dat
  echo "9.团队、会议、账号登录、未保存、协作 had been removed."
else
  echo "9.There is no file product.dat"
fi
# 发出确认信息
echo "We have removed the  pdf component of wps-office"
echo "********************************************"
echo "*                                          *"
echo "*                                          *"
echo "*      Happy wps-office Writing!           *"
echo "*                                          *"
echo "*                                          *"
echo "********************************************"

